package com.bbx.taxi.client.Util;

import android.content.Context;
import android.content.Intent;

import com.bbx.api.util.LogUtils;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.Service.LoginService;

/** 
 * @Path com.bbx.taxi.client.Util.ServiceRunning.java
 * @Author 严旭文
 * @Date 2016-1-7 下午5:27:38
 * @Company 蓝海（福建）信息技术有限公司
 * @Description
 */
public class ServiceRunning {
	public static void IsServiceRunning(Context context,boolean isDetecte){
       if(isDetecte&&!IsServiceRunning.isServiceWork(context, "com.bbx.taxi.client.Service.LoginService")){
    	   LogUtils.e("bbx","检测到没有运行");
    	   MyApplication mApplication=MyApplication.getInstance();
    	   if(mApplication!=null&&mApplication.getUid()!=null&&!mApplication.getUid().equals("")&&
    	     mApplication.getToken()!=null&&!mApplication.getToken().equals("")){
    		   LogUtils.e("bbx","启动服务");
    	    	// 启动登陆Service
        	   context.startService(new Intent(context, LoginService.class));
    	   }
       }
    }
}
